package com.moon.robot;

import com.baidu.aip.contentcensor.AipContentCensor;

import com.moon.robot.pojo.Group;
import com.moon.robot.pojo.GroupMsgs;
import com.moon.robot.pojo.Qq;
import com.moon.robot.pojo.Reply;
import com.moon.robot.service.GroupService;
import com.moon.robot.service.QQService;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;


import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

@SpringBootApplication
@MapperScan("com.moon.robot.mapper")

public class RobotApplication {
    public static List<Reply> VagueReplyList = new ArrayList<>();
    public static List<Qq> qqList = new ArrayList<>();
    public static boolean Jurisdiction = false; //false无
    public static boolean groupcode = false; //false无
    public static List<String> allGroup = new ArrayList<>();


    //设置APPID/AK/SK
    //鉴黄
    public static final String APP_ID = "17781892";
    public static final String API_KEY = "Shuhma52K80Gd1Zy60YOlbyw";
    public static final String SECRET_KEY = "8C5cObVaetuY7zRGR0vy7nwBZWxpGryn";


    public static AipContentCensor Jianhuangclient;
    public static boolean Notice = false;

    public static LinkedList<GroupMsgs> lastnews = new LinkedList<GroupMsgs>();

    public static void main(String[] args) throws IOException {


        ConfigurableApplicationContext run = SpringApplication.run(RobotApplication.class, args);
        /*DependCenter dependCenter = simpleRobotContext.getDependCenter();
        GroupService groupService = dependCenter.get(GroupService.class);
        QQService qqService = dependCenter.get(QQService.class);*/
        ConfigurableListableBeanFactory beanFactory = run.getBeanFactory();

        GroupService groupService = beanFactory.getBean(GroupService.class);
        QQService qqService = beanFactory.getBean(QQService.class);

        VagueReplyList = groupService.SelectAllVague();
        qqList = qqService.findAllQQ();
        allGroup = groupService.findAllGroup();

        // 初始化一个AipContentCensor
        Jianhuangclient = new AipContentCensor(APP_ID, API_KEY, SECRET_KEY);
        // 可选：设置网络连接参数
        Jianhuangclient.setConnectionTimeoutInMillis(2000);
        Jianhuangclient.setSocketTimeoutInMillis(60000);
    }

}
